#include "PointEntity.h"
#include <QPainter>

PointEntity::PointEntity(void)
{
}


PointEntity::~PointEntity(void)
{
}

TGS::GeoMath::Envelope PointEntity::getEnvelope() const 
{
	if(!isSpaceModel()) return Envelope();

	Envelope envelope;
	envelope.expandToInclude(_point);

	return envelope;
}

void PointEntity::render( RenderContext* renderContext )
{
	renderContext->painter()->save();

	QPoint point = renderContext->mapToPixel().mapToScreen(_point);

	QPen pen(QBrush(getColor()), getWidth());
	renderContext->painter()->setPen(pen);
	renderContext->painter()->drawPoint(point);

	renderContext->painter()->restore();
}

void PointEntity::traslate( const Point& point )
{
	_point.setX(_point.getX() + point.getX());
	_point.setY(_point.getY() + point.getY());
}
